﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using TGBTech.Core.Models.Services;

namespace TGBTech.WebAdmin.Controllers
{
    public class TheKhoController : Controller
    {
        //
        // GET: /TheKho/
        public ActionResult Index()
        {
            return View();
        }

        public ActionResult Create()
        {
            return View();
        }

        [HttpPost]
        public ActionResult Create(String MaHang, DateTime? StartDate, DateTime? EndDate)
        {
            SoChiTietSPVLHHServices services = new SoChiTietSPVLHHServices();
            bool result = services.CreateSo(MaHang, StartDate, EndDate);

            // Fail
            if (result == false)
                return View();

            // Success
            ViewBag.So = services.So;
            return View("Create", services.So.ListModel);
        }
	}
}